{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0132364c",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (4199549200.py, line 10)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn [2], line 10\u001b[1;36m\u001b[0m\n\u001b[1;33m    While_True:\u001b[0m\n\u001b[1;37m               ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "#1. 运行程序后，让用户输入支付宝余额，然后打印我们的商品列表给用户\n",
    "\n",
    "Good_List = [[\"盲盒\",99],\n",
    "             [\"杯子\",800],\n",
    "             [\"Nike联名款\",699]]\n",
    "# 数据存放，列表的增加(append)\n",
    "shopping_list= []\n",
    "Alipay = int(input(\"请输入余额：\"))\n",
    "\n",
    "While_True:\n",
    "    print(------\"三丽鸥商店\"-----)\n",
    "    for i in range(3):\n",
    "        print(i_Good_List[i][0],str(Good_list[i][1]+\"元\"))   #0代表取出列表第一个值，两个值取出价格\n",
    "        \n",
    "#2. 让用户输入商品编号进行商品的购买,\n",
    "    user_choice = input(\"请输入商品编号;\")\n",
    "    \n",
    "#3. 用户选择商品后，检查用户的余额是否足够，若足够则直接扣款，不够则提醒用户\n",
    "#3.1 用户输入商品序号(数值)\n",
    "     if user_choice,isdigit() and int(user_choice)<len(Good_list) and int (user_choice)>=0:\n",
    "        user_choice=int(user_choice)\n",
    "        if Alipay > Good_list[user_choice][i]:\n",
    "            #余额足够\n",
    "            Alipay = Alipay - Good_list[user_choice][1] #更新用户余额\n",
    "            shopping_list,append(Good_list[user_choice])\n",
    "            print(\"购买成功，请等待商品出货，您的余额还有: %s元\"(Alipay))\n",
    "        else:\n",
    "            #余额不够\n",
    "            print(\"您的余额不够\"+str(Good_list[user_choice][1])+\"请更换交付方式或者选择其他商品\"）\n",
    "#3.2 用户输入其他\n",
    "     elif user_choice == \"q\":\n",
    "                  print(\"感谢你的购买，欢迎下次光临\")\n",
    "                  print(\"您的购物车:\",shopping_list)\n",
    "                  print(\"您的余额还有:\",Alipay)\n",
    "                  break\n",
    "     else:\n",
    "                  print(\"您输入的商品不存在或者输入的内容有误\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "fc6239ee",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid character '，' (U+FF0C) (4138453631.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn [3], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m    products = [[\"iphone\",6888],[\"MacPro\",14800],[\"小米6\"，1499]，[\"Coffee\",31][\"Book\",60],[\"Nike\",699]]\u001b[0m\n\u001b[1;37m                                                       ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid character '，' (U+FF0C)\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ce92f15a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
